var root = ui("$");
root.setMapping({
	"imgLogo.tag" : "bussId",//用户ID或群组ID
	"imgLogo.source" : "logo",//单聊
	"imgLogoG.source" : "logo",//群聊
	"lableName.tag" : "imId",
	"lableName.text" : "name",
	"labelLastMsg.text" : "last",
	"lableTime.text" : "time",
	"lableNewMsg.text" : "newMsgCount",
	"lableNewMsg.visible" : "showNewMsgTip",
	"do_ALayout_root.tag" : "type", //群聊、单聊(GroupChat、Chat)
	"gridLogo4.tag" : "imgItems",
	"do_ALayout_group.tag" : "isCircle"
});

var imgLogoG = ui("imgLogoG");
var gridLogo4 = ui("gridLogo4");
var gridLogo6 = ui("gridLogo6");
var gridLogo9 = ui("gridLogo9");
root.on("dataRefreshed", function(){
	var chatType = ui("do_ALayout_root").tag;
	if(chatType == "Chat"){//单聊，显示圆形头象
		ui("do_ALayout_single").visible = true;
		ui("do_ALayout_group").visible = false;
	}else{//群聊，显示方形头象
		ui("do_ALayout_single").visible = false;
		ui("do_ALayout_group").visible = true;
		var isCircle = ui("do_ALayout_group").tag;
		if(isCircle=="1"){
			gridLogo4.visible = false;
			gridLogo6.visible = false;
			gridLogo9.visible = false;
			imgLogoG.visible = true;
		}else{
			imgLogoG.visible = false;
			var imgItems = JSON.parse(ui("gridLogo4").tag);
			var logoCount = imgItems.length;
			if(logoCount<=4){
				gridLogo4.visible = true;
				gridLogo6.visible = false;
				gridLogo9.visible = false;
				gridLogo4.items = imgItems;
			}else if(logoCount<=6){
				gridLogo4.visible = false;
				gridLogo6.visible = true;
				gridLogo9.visible = false;
				gridLogo6.items = imgItems;
			}else{
				gridLogo4.visible = false;
				gridLogo6.visible = false;
				gridLogo9.visible = true;
				gridLogo9.items = imgItems;
			}
		}
	}
});
